package extend;

/**
 * @Package: extend
 * @ClassName: Base
 * @Author: x2606
 * @CreateTime: 2022/2/20 20:37
 * @Description: 父类
 */

public class Base {
    //属性
    public int n1 = 1;
    protected int n2 = 2;
    int n3 = 3;
    private int n4 = 4;

    //无参构造器
//    public Base() {
//        System.out.println("base无参构造器");
//    }

    //有参构造器
    public Base(int n4) {
        System.out.println("base有参构造器");
        this.n4 = n4;
    }

    //访问私有属性的公共方法
    public int getN4() {
        return n4;
    }
    //其他方法
    public void test1(){
        System.out.println("test1");
    }
    protected void test2(){
        System.out.println("test2");
    }
    void test3(){
        System.out.println("test3");
    }
    private void test4(){
        System.out.println("test4");
    }

}
